package br.com.foxinline.servico;

import br.com.foxinline.modelo.AnimalDomicilio;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.Query;

/**
 *
 * @author laverson
 */
@Stateless
public class AnimalDomicilioServico extends ServicoGenerico<AnimalDomicilio> {

    public AnimalDomicilioServico() {
        super(AnimalDomicilio.class);
    }

    public List<AnimalDomicilio> autocomplete(String query) {

        String sql = "SELECT animal FROM AnimalDomicilio animal WHERE LOWER(animal.nome) LIKE LOWER(:nome)";

        Query querya = getEntityManager().createQuery(sql);

        return querya.getResultList();
    }
}
